package com.yh.javabean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Set;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Users implements UserDetails{
    private int id;
    private String email;
    private String username;
    private String password;
    private String phoneNum;
    private int status;// '状态0 未开启 1 开启'
    private String statusStr;
    private Role role;
    private  Set<GrantedAuthority> authorities;
    private  boolean accountNonExpired; //帐户是否过期
    private  boolean accountNonLocked; //帐户是否锁定
    private  boolean credentialsNonExpired; //认证是否过期
    private  boolean enabled; //帐户是否可用

    public String getStatusStr() {
        if(status==0){
            statusStr="未开启";
        }else if(status==1){
            statusStr="开启";
        }
        return statusStr;
    }
}